<template>
  <div class="scenario-management">
    <!-- 页面标题 -->
  <div class="page-title-box margin-b-10 flex-par">
    <img src="../../assets/image/icon6.png" class="title-icon" alt="">
    <div>应用场景管理</div>
  </div>

    <!-- 操作工具栏 -->
    <div class="toolbar">
      <div class="toolbar-left">
        <el-button type="primary" @click="showAddDialog" :icon="Plus">新增业务类型</el-button>
        <el-button @click="refreshList" :icon="Refresh">刷新</el-button>
        <el-button @click="showSubTypeDialog" :icon="Menu">子类型管理</el-button>
      </div>
      <div class="toolbar-right">
        <el-input 
          v-model="searchKeyword" 
          placeholder="搜索业务类型..." 
          @input="handleSearch"
          style="width: 300px;"
          clearable
        >
          <template #prefix>
            <el-icon><Search /></el-icon>
          </template>
        </el-input>
      </div>
    </div>

    <!-- 主内容区 -->
  <div class="list-content white-bk">
      <el-table 
        :data="filteredBizTypeList" 
        v-loading="loading"
        stripe
        border
        style="width: 100%"
        empty-text="暂无数据"
        :show-header="true"
        :header-cell-style="{ 
          background: '#f5f7fa', 
          color: '#606266', 
          fontWeight: 'bold',
          fontSize: '14px',
          textAlign: 'center',
          border: '1px solid #dcdfe6'
        }"
      >
        <el-table-column prop="typeCode" label="编码" width="220" align="center" />
        <el-table-column prop="typeName" label="名称" width="200" align="center" />
        <el-table-column prop="description" label="描述" align="center" show-overflow-tooltip />
        <el-table-column prop="sortOrder" label="排序" width="80" align="center" />
        <el-table-column prop="status" label="状态" width="100" align="center">
          <template #default="scope">
            <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
              {{ scope.row.status === 1 ? '启用' : '禁用' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间" width="180" align="center">
          <template #default="scope">
            {{ formatDateTime(scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column label="操作" width="280" fixed="right">
          <template #default="scope">
            <div class="action-buttons">
              <el-button size="small" @click="editBizType(scope.row)" :icon="Edit">编辑</el-button>
              <el-button size="small" @click="manageSubTypes(scope.row)" :icon="Menu">子类型</el-button>
              <el-button 
                size="small" 
                :type="scope.row.status === 1 ? 'warning' : 'success'"
                @click="toggleStatus(scope.row)"
              >
                {{ scope.row.status === 1 ? '禁用' : '启用' }}
              </el-button>
              <el-button size="small" type="danger" @click="deleteBizType(scope.row)" :icon="Delete">删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
    <div class="pagination-box flex-par">
        <el-pagination 
          class="flex-par" 
          :currentPage="searchForm.pageNum" 
          :page-size="searchForm.pageSize" 
          :small="true"
          background="#F4F4F4" 
          layout="total, prev, pager, next" 
          :total="dataTotal" 
          @current-change="getPageList" 
        />
    </div>
    </div>

    <!-- 新增/编辑业务类型对话框 -->
    <el-dialog 
      :title="dialogTitle" 
      v-model="dialogVisible" 
      width="600px"
      :close-on-click-modal="false"
    >
      <el-form 
        :model="formData" 
        :rules="formRules" 
        ref="formRef"
        label-width="100px"
      >
        <el-form-item label="编码" prop="typeCode">
          <el-input 
            v-model="formData.typeCode" 
            @blur="checkCode"
            placeholder="请输入业务类型编码"
            :disabled="isEdit"
          />
          <div v-if="codeCheckMessage" class="code-check-message" :class="codeCheckResult ? 'success' : 'error'">
            {{ codeCheckMessage }}
          </div>
        </el-form-item>
        <el-form-item label="名称" prop="typeName">
          <el-input v-model="formData.typeName" placeholder="请输入业务类型名称" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input 
            type="textarea" 
            v-model="formData.description" 
            placeholder="请输入业务类型描述"
            :rows="3"
          />
        </el-form-item>
        <el-form-item label="排序" prop="sortOrder">
          <el-input-number 
            v-model="formData.sortOrder" 
            :min="0"
            :max="999"
            controls-position="right"
          />
        </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-radio-group v-model="formData.status">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <template #footer>
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitForm" :loading="submitLoading">确定</el-button>
      </template>
    </el-dialog>

    <!-- 子业务类型管理对话框 -->
    <el-dialog 
      title="子业务类型管理" 
      v-model="subTypeDialogVisible" 
      width="1000px"
      :close-on-click-modal="false"
    >
      <div class="sub-type-header">
        <h4>父业务类型：{{ currentParentType?.typeName }}</h4>
        <el-button type="primary" @click="showAddSubTypeDialog" :icon="Plus">新增子类型</el-button>
      </div>
      
      <el-table 
        :data="subTypeList" 
        v-loading="subTypeLoading"
        stripe
        border
        style="width: 100%; margin-top: 20px;"
        empty-text="暂无子业务类型"
      >
        <el-table-column prop="typeCode" label="编码" width="220" align="center" />
        <el-table-column prop="typeName" label="名称" width="200" align="center" />
        <el-table-column prop="description" label="描述" align="center" show-overflow-tooltip />
        <el-table-column prop="sortOrder" label="排序" width="80" align="center" />
        <el-table-column prop="status" label="状态" width="100" align="center">
          <template #default="scope">
            <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
              {{ scope.row.status === 1 ? '启用' : '禁用' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="160">
          <template #default="scope">
            <div class="action-buttons">
              <el-button size="small" @click="editSubType(scope.row)" :icon="Edit">编辑</el-button>
              <el-button size="small" type="danger" @click="deleteSubType(scope.row)" :icon="Delete">删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <!-- 新增/编辑子业务类型对话框 -->
    <el-dialog 
      :title="subTypeDialogTitle" 
      v-model="subTypeFormVisible" 
      width="600px"
      :close-on-click-modal="false"
    >
      <el-form 
        :model="subTypeFormData" 
        :rules="subTypeFormRules" 
        ref="subTypeFormRef"
        label-width="100px"
      >
        <el-form-item label="编码" prop="typeCode">
          <el-input 
            v-model="subTypeFormData.typeCode" 
            @blur="checkSubTypeCode"
            placeholder="请输入子业务类型编码"
            :disabled="isEditSubType"
          />
          <div v-if="subTypeCodeCheckMessage" class="code-check-message" :class="subTypeCodeCheckResult ? 'success' : 'error'">
            {{ subTypeCodeCheckMessage }}
          </div>
        </el-form-item>
        <el-form-item label="名称" prop="typeName">
          <el-input v-model="subTypeFormData.typeName" placeholder="请输入子业务类型名称" />
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <el-input 
            type="textarea" 
            v-model="subTypeFormData.description" 
            placeholder="请输入子业务类型描述"
            :rows="3"
          />
        </el-form-item>
        <el-form-item label="排序" prop="sortOrder">
          <el-input-number 
            v-model="subTypeFormData.sortOrder" 
            :min="0"
            :max="999"
            controls-position="right"
          />
        </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-radio-group v-model="subTypeFormData.status">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <template #footer>
        <el-button @click="subTypeFormVisible = false">取消</el-button>
        <el-button type="primary" @click="submitSubTypeForm" :loading="submitLoading">确定</el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script>
import { 
  getBizTypeList, 
  createBizType, 
  updateBizType, 
  deleteBizType,
  getSubBizTypesByParentId,
  createSubBizType,
  updateSubBizType,
  deleteSubBizType,
  checkBizTypeCode,
  checkSubBizTypeCode
} from '@/assets/api/api.js';
import { Plus, Refresh, Menu, Search, Edit, Delete } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox } from 'element-plus';

export default {
  name: 'ScenarioList',
  components: {
    Plus,
    Refresh,
    Menu,
    Search,
    Edit,
    Delete
  },
  data() {
    return {
      // 基础数据
      loading: false,
      submitLoading: false,
      bizTypeList: [],
      dataTotal: 0,
      searchKeyword: '',
      
      // 分页
      searchForm: {
        pageNum: 1,
        pageSize: 10
      },
      
      // 业务类型对话框
      dialogVisible: false,
      dialogTitle: '新增业务类型',
      isEdit: false,
      formData: {
        id: undefined,
        typeCode: '',
        typeName: '',
        description: '',
        sortOrder: 0,
        status: 1
      },
      formRules: {
        typeCode: [
          { required: true, message: '请输入业务类型编码', trigger: 'blur' },
          { min: 2, max: 50, message: '编码长度在2到50个字符', trigger: 'blur' }
        ],
        typeName: [
          { required: true, message: '请输入业务类型名称', trigger: 'blur' },
          { min: 2, max: 100, message: '名称长度在2到100个字符', trigger: 'blur' }
        ],
        description: [
          { max: 500, message: '描述不能超过500个字符', trigger: 'blur' }
        ],
        sortOrder: [
          { required: true, message: '请输入排序值', trigger: 'blur' }
        ],
        status: [
          { required: true, message: '请选择状态', trigger: 'change' }
        ]
      },
      
      // 编码检查
      codeCheckMessage: '',
      codeCheckResult: false,
      
      // 子业务类型管理
      subTypeDialogVisible: false,
      subTypeFormVisible: false,
      subTypeDialogTitle: '新增子业务类型',
      isEditSubType: false,
      subTypeLoading: false,
      subTypeList: [],
      currentParentType: null,
      subTypeFormData: {
        id: undefined,
        parentTypeId: undefined,
        typeCode: '',
        typeName: '',
        description: '',
        sortOrder: 0,
        status: 1
      },
      subTypeFormRules: {
        typeCode: [
          { required: true, message: '请输入子业务类型编码', trigger: 'blur' },
          { min: 2, max: 50, message: '编码长度在2到50个字符', trigger: 'blur' }
        ],
        typeName: [
          { required: true, message: '请输入子业务类型名称', trigger: 'blur' },
          { min: 2, max: 100, message: '名称长度在2到100个字符', trigger: 'blur' }
        ],
        description: [
          { max: 500, message: '描述不能超过500个字符', trigger: 'blur' }
        ],
        sortOrder: [
          { required: true, message: '请输入排序值', trigger: 'blur' }
        ],
        status: [
          { required: true, message: '请选择状态', trigger: 'change' }
        ]
      },
      subTypeCodeCheckMessage: '',
      subTypeCodeCheckResult: false
    }
  },
  computed: {
    filteredBizTypeList() {
      if (!this.searchKeyword) {
        return this.bizTypeList;
      }
      return this.bizTypeList.filter(item => 
        item.typeName.includes(this.searchKeyword) || 
        item.typeCode.includes(this.searchKeyword)
      );
    }
  },
  mounted() {
    // 暂时禁用权限检查，直接加载数据
    // this.checkPermission();
    this.getBizTypeList();
  },
  methods: {
    // 权限检查
    async checkPermission() {
      try {
        // 先尝试从localStorage获取用户角色
        let userRole = localStorage.getItem('userRole') || localStorage.getItem('myUserType');
        
        // 如果没有用户角色信息，则调用API获取
        if (!userRole) {
          const { getMyUserInfo } = await import('@/assets/api/api.js');
          const res = await getMyUserInfo();
          
          if (res.code === 0 && res.data) {
            userRole = res.data.role || res.data.userType;
            // 存储到localStorage
            if (userRole) {
              localStorage.setItem('userRole', userRole);
            }
          }
        }
        
        // 检查是否为管理员（支持多种管理员标识）
        const adminRoles = ['ADMIN', 'admin', 'Admin', '管理员'];
        if (!adminRoles.includes(userRole)) {
          ElMessage.error('权限不足，仅管理员可访问业务类型管理');
          this.$router.push('/kaifa');
          return false;
        }
        return true;
      } catch (error) {
        console.error('权限检查失败:', error);
        ElMessage.error('权限检查失败，请重新登录');
        this.$router.push('/loginPage');
        return false;
      }
    },
    
    // 获取业务类型列表
    async getBizTypeList() {
      this.loading = true;
      try {
        const res = await getBizTypeList();
        if (res.code === 0) {
          this.bizTypeList = res.data || [];
          this.dataTotal = this.bizTypeList.length;
        } else {
          ElMessage.error(res.message || '获取业务类型列表失败');
        }
      } catch (error) {
        console.error('获取业务类型列表失败:', error);
        ElMessage.error('获取业务类型列表失败');
      } finally {
        this.loading = false;
      }
    },
    
    // 刷新列表
    refreshList() {
      this.getBizTypeList();
    },
    
    // 搜索处理
    handleSearch() {
      // 搜索逻辑在computed中处理
    },
    
    // 显示新增对话框
    showAddDialog() {
      this.dialogTitle = '新增业务类型';
      this.isEdit = false;
      this.formData = {
        id: undefined,
        typeCode: '',
        typeName: '',
        description: '',
        sortOrder: 0,
        status: 1
      };
      this.codeCheckMessage = '';
      this.dialogVisible = true;
    },
    
    // 编辑业务类型
    editBizType(row) {
      this.dialogTitle = '编辑业务类型';
      this.isEdit = true;
      this.formData = { ...row };
      this.codeCheckMessage = '';
      this.dialogVisible = true;
    },
    
    // 检查编码唯一性
    async checkCode() {
      if (!this.formData.typeCode) return;
      
      try {
        const res = await checkBizTypeCode(this.formData.typeCode, this.formData.id);
        if (res.code === 0) {
          this.codeCheckResult = !res.data;
          this.codeCheckMessage = res.data ? '编码已存在' : '编码可用';
        }
      } catch (error) {
        console.error('检查编码失败:', error);
        this.codeCheckMessage = '检查编码失败';
        this.codeCheckResult = false;
      }
    },
    
    // 提交表单
    async submitForm() {
      try {
        await this.$refs.formRef.validate();
        
        if (!this.codeCheckResult && this.formData.typeCode) {
          ElMessage.warning('请检查编码是否可用');
          return;
        }
        
        this.submitLoading = true;
        
        let res;
        if (this.isEdit) {
          res = await updateBizType(this.formData);
        } else {
          res = await createBizType(this.formData);
        }
        
        if (res.code === 0) {
          ElMessage.success(this.isEdit ? '更新成功' : '创建成功');
          this.dialogVisible = false;
          this.getBizTypeList();
        } else {
          ElMessage.error(res.message || '操作失败');
        }
      } catch (error) {
        console.error('提交失败:', error);
        ElMessage.error('操作失败');
      } finally {
        this.submitLoading = false;
      }
    },
    
    // 切换状态
    async toggleStatus(row) {
      try {
        const newStatus = row.status === 1 ? 0 : 1;
        const res = await updateBizType({ ...row, status: newStatus });
        
        if (res.code === 0) {
          ElMessage.success('状态更新成功');
          this.getBizTypeList();
        } else {
          ElMessage.error(res.message || '状态更新失败');
        }
      } catch (error) {
        console.error('状态更新失败:', error);
        ElMessage.error('状态更新失败');
      }
    },
    
    // 删除业务类型
    async deleteBizType(row) {
      try {
        await ElMessageBox.confirm(
          `确定要删除业务类型"${row.typeName}"吗？删除后不可恢复！`,
          '确认删除',
          {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }
        );
        
        const res = await deleteBizType(row.id);
        if (res.code === 0) {
          ElMessage.success('删除成功');
          this.getBizTypeList();
        } else {
          ElMessage.error(res.message || '删除失败');
        }
      } catch (error) {
        if (error !== 'cancel') {
          console.error('删除失败:', error);
          ElMessage.error('删除失败');
        }
      }
    },
    
    // 管理子类型
    async manageSubTypes(row) {
      this.currentParentType = row;
      this.subTypeDialogVisible = true;
      await this.getSubTypeList(row.id);
    },
    
    // 获取子业务类型列表
    async getSubTypeList(parentTypeId) {
      this.subTypeLoading = true;
      try {
        const res = await getSubBizTypesByParentId(parentTypeId);
        if (res.code === 0) {
          this.subTypeList = res.data || [];
        } else {
          ElMessage.error(res.message || '获取子业务类型列表失败');
        }
      } catch (error) {
        console.error('获取子业务类型列表失败:', error);
        ElMessage.error('获取子业务类型列表失败');
      } finally {
        this.subTypeLoading = false;
      }
    },
    
    // 显示新增子类型对话框
    showAddSubTypeDialog() {
      this.subTypeDialogTitle = '新增子业务类型';
      this.isEditSubType = false;
      this.subTypeFormData = {
        id: undefined,
        parentTypeId: this.currentParentType.id,
        typeCode: '',
        typeName: '',
        description: '',
        sortOrder: 0,
        status: 1
      };
      this.subTypeCodeCheckMessage = '';
      this.subTypeFormVisible = true;
    },
    
    // 编辑子类型
    editSubType(row) {
      this.subTypeDialogTitle = '编辑子业务类型';
      this.isEditSubType = true;
      this.subTypeFormData = { ...row };
      this.subTypeCodeCheckMessage = '';
      this.subTypeFormVisible = true;
    },
    
    // 检查子类型编码唯一性
    async checkSubTypeCode() {
      if (!this.subTypeFormData.typeCode) return;
      
      try {
        const res = await checkSubBizTypeCode(this.subTypeFormData.typeCode, this.subTypeFormData.id);
        if (res.code === 0) {
          this.subTypeCodeCheckResult = !res.data;
          this.subTypeCodeCheckMessage = res.data ? '编码已存在' : '编码可用';
        }
      } catch (error) {
        console.error('检查子类型编码失败:', error);
        this.subTypeCodeCheckMessage = '检查编码失败';
        this.subTypeCodeCheckResult = false;
      }
    },
    
    // 提交子类型表单
    async submitSubTypeForm() {
      try {
        await this.$refs.subTypeFormRef.validate();
        
        if (!this.subTypeCodeCheckResult && this.subTypeFormData.typeCode) {
          ElMessage.warning('请检查编码是否可用');
          return;
        }
        
        this.submitLoading = true;
        
        let res;
        if (this.isEditSubType) {
          res = await updateSubBizType(this.subTypeFormData);
        } else {
          res = await createSubBizType(this.subTypeFormData);
        }
        
        if (res.code === 0) {
          ElMessage.success(this.isEditSubType ? '更新成功' : '创建成功');
          this.subTypeFormVisible = false;
          this.getSubTypeList(this.currentParentType.id);
        } else {
          ElMessage.error(res.message || '操作失败');
        }
      } catch (error) {
        console.error('提交子类型失败:', error);
        ElMessage.error('操作失败');
      } finally {
        this.submitLoading = false;
      }
    },
    
    // 删除子类型
    async deleteSubType(row) {
      try {
        await ElMessageBox.confirm(
          `确定要删除子业务类型"${row.typeName}"吗？删除后不可恢复！`,
          '确认删除',
          {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }
        );
        
        const res = await deleteSubBizType(row.id);
        if (res.code === 0) {
          ElMessage.success('删除成功');
          this.getSubTypeList(this.currentParentType.id);
        } else {
          ElMessage.error(res.message || '删除失败');
        }
      } catch (error) {
        if (error !== 'cancel') {
          console.error('删除子类型失败:', error);
          ElMessage.error('删除失败');
        }
      }
    },
    
    // 显示子类型管理对话框
    showSubTypeDialog() {
      ElMessage.info('请先选择一个业务类型，然后点击"子类型"按钮进行管理');
    },
    
    // 格式化时间
    formatDateTime(dateTime) {
      if (!dateTime) return '-';
      return this.$formateDateTime(new Date(dateTime).getTime(), 1);
    }
  }
};
</script>
<style scoped>
.scenario-management {
  height: 100%;
  background: #f8f8f8;
}

/* 页面标题 */
.page-title-box {
  height: 60px;
  line-height: 60px;
  color: #00152A;
  font-size: 18px;
  font-weight: 600;
  background-color: white;
  padding: 0 20px;
  border-bottom: 1px solid #e4e7ed;
}

.title-icon {
  height: 35px;
  margin: 12.5px 5px 0 10px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: white;
  border-bottom: 1px solid #e4e7ed;
}

.toolbar-left {
  display: flex;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
}

/* 主内容区 */
.list-content {
  background: white;
  margin: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* 操作按钮样式 */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.action-buttons .el-button {
  margin: 0;
  flex-shrink: 0;
}

/* 分页 */
.pagination-box {
  padding: 20px;
  background: #fafafa;
  border-top: 1px solid #e4e7ed;
  justify-content: center;
}

/* 编码检查消息 */
.code-check-message {
  font-size: 12px;
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 4px;
}

.code-check-message.success {
  color: #67c23a;
  background: #f0f9ff;
  border: 1px solid #b3e19d;
}

.code-check-message.error {
  color: #f56c6c;
  background: #fef0f0;
  border: 1px solid #fbc4c4;
}

/* 子类型管理 */
.sub-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #e4e7ed;
}

.sub-type-header h4 {
  margin: 0;
  color: #303133;
  font-size: 16px;
}

/* 表格样式优化 */
:deep(.el-table) {
  border-radius: 0;
}

:deep(.el-table__header-wrapper) {
  display: block !important;
}

:deep(.el-table__header) {
  display: table !important;
  width: 100% !important;
}

:deep(.el-table__header tr) {
  display: table-row !important;
}

:deep(.el-table__header th) {
  display: table-cell !important;
  visibility: visible !important;
}

:deep(.el-table th) {
  background: #fafafa !important;
  color: #606266 !important;
  font-weight: 600 !important;
  display: table-cell !important;
  visibility: visible !important;
  height: 40px !important;
  line-height: 40px !important;
}

:deep(.el-table td) {
  padding: 12px 0;
}

:deep(.el-table .cell) {
  padding: 0 12px;
}

/* 按钮组样式 */
:deep(.el-button + .el-button) {
  margin-left: 8px;
}

/* 对话框样式 */
:deep(.el-dialog__header) {
  padding: 20px 20px 10px;
  border-bottom: 1px solid #e4e7ed;
}

:deep(.el-dialog__body) {
  padding: 20px;
}

:deep(.el-dialog__footer) {
  padding: 10px 20px 20px;
  border-top: 1px solid #e4e7ed;
}

/* 表单样式 */
:deep(.el-form-item__label) {
  font-weight: 600;
  color: #606266;
}

:deep(.el-input__wrapper) {
  border-radius: 6px;
}

:deep(.el-textarea__inner) {
  border-radius: 6px;
}

/* 状态标签 */
:deep(.el-tag) {
  border-radius: 4px;
  font-weight: 500;
}

/* 加载状态 */
:deep(.el-loading-mask) {
  border-radius: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .toolbar {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .toolbar-right {
    justify-content: center;
  }
  
  .list-content {
    margin: 10px;
  }
  
  :deep(.el-table) {
    font-size: 12px;
  }
  
  :deep(.el-button) {
    padding: 5px 8px;
    font-size: 12px;
  }
}

/* 工具类 */
.margin-b-10 {
  margin-bottom: 10px;
}

.flex-par {
  display: flex;
  align-items: center;
}

.white-bk {
  background: white;
}

/* 动画效果 */
.el-button {
  transition: all 0.3s ease;
}

.el-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 表格行悬停效果 */
:deep(.el-table__row:hover) {
  background: #f5f7fa;
}

/* 分页器样式 */
:deep(.el-pagination) {
  justify-content: center;
}

:deep(.el-pagination .el-pager li) {
  border-radius: 4px;
  margin: 0 2px;
}

:deep(.el-pagination .btn-prev),
:deep(.el-pagination .btn-next) {
  border-radius: 4px;
}
</style>